
import { ClockCircleOutlined } from '@ant-design/icons';
import { Badge, Button, Space, Switch, Tag } from 'antd';
import React, { useState } from 'react';


export const AformConfig = [
    {
        type: "Input",
        lable: "标题",
        placenholder: "请输入文章标题",
        key: "title",
    },
    {
        type: "Select",
        lable: "状态",
        placenholder: "请输入联系方式",
        key: "pass",
        options: [
            {
                key: "1",
                lable: "已发布"
            },
            {
                key: "0",
                lable: "草稿"
            }
        ]
    },
    {
        type: "Select",
        lable: "分类",
        placenholder: "请输入文件类型",
        key: "category",
        options: [
            {
                key: "ecae4305-80d9-42d1-b96c-44ab4e0e9da2",
                lable: "前端"
            },
            {
                key: "bee7fd92-f1bd-429f-98b0-6e72bcc33107",
                lable: "分类1"
            },
            {
                key: "7b6a3bf9-bb61-4c27-bff0-b50e9d55fe6f",
                lable: "React"
            },
            {
                key: "ce805419-8efc-4f16-bc40-4cd3ba9a1d99",
                lable: "Vue"
            },
            {
                key: "2602871e-9e7f-4d1e-9d66-eeba6a16da73",
                lable: "后端"
            },
            {
                key: "0dae19a2-24a9-4f3f-a603-b110152cb31e",
                lable: "admin"
            },
        ]
    },
    {
        type: "Find",
        text: "收搜"
    },
    {
        type: "Reset",
        text: "重置"
    }

]

export const tableColumns = (
    PassCommrnt: (id: number, flag: boolean) => void,
    Recomment: (record: object) => void,
    DeleteComment: (id: number) => void) => {
    return [
        {
            title: '标题',
            dataIndex: 'title',
            key: 'title',

        },
        {
            title: '状态',
            dataIndex: 'status',
            key: 'status',
            // render()
            render(text: string) {
                return text === "publish" ? <span><Badge status="success" ></Badge> 已发布</span> : <span><Badge status="warning" ></Badge> 草稿</span>
            }
        },
        {
            title: '分类',
            dataIndex: 'label',
            key: 'label',
            render(text: any) {
                return text?.label == "前端" ? <Tag color="lime">前端</Tag> : <Tag color="#f50">分类1</Tag>
            }
        },
        {
            title: '阅读量',
            dataIndex: 'views',
            key: 'views',
            // render(text: any) {
            //     return <Badge
            //         className="site-badge-count-109"
            //         count={text}
            //         style={{ backgroundColor: '#52c41a' }}
            //     />
            // }
        },
        {
            title: '喜欢数',
            dataIndex: 'likes',
            key: 'likes',
            // render(text: any) {
            //     return <Badge count={text}></Badge>
            // }
        },
        {
            title: '发布时间',
            dataIndex: 'publishAt',
            key: 'publishAt',
        },

        {
            title: '操作',
            dataIndex: 'action',
            key: 'action',
            render: (_: any, record: any) => {
                // const id=record.id
                console.log(_, record)
                const id = record.id
                return (
                    // PassCommrnt: (id: number, flag: boolean) => void,
                    // Recomment: (record: object) => void,
                    // DeleteComment: (id: number) => void
                    <>
                        <Button type='link' onClick={() => PassCommrnt(id, true)}>通过</Button>
                        <Button type='link'>拒绝</Button>
                        <Button type='link' onClick={() => { Recomment(record) }}>回复</Button>
                        <Button type='link'>删除</Button>
                    </>
                )
            }
        }
    ];

}